#include<avr/io.h>
#include<avr/interrupt.h>
#include"filter.h"


int filter_rms(unsigned char number,int in)
{
static long int out[4]={0,0,0,0};
unsigned char kx,ky;

	if(in>out[number])  kx=171, ky=84; else  kx=10,ky=245;
	 	 
	out[number]=kx*in+out[number]*ky;
	out[number]/=256;

	return out[number];
}
